IModel.AddNewModelTo method ¶
Namespace: NextDesign.Core
Description¶
Adds an instance of the specified class with the specified position to the specified field of this instance as the field value. Allows instantiation even if the specified class is abstract and adds it as a field value at the specified position. The specified field must be owned by the class type. Note that no exception is thrown even if the multiplicity upper limit constraint for fields with multiplicity of 2 or more is violated.
The specified class name must be compatible with the field data type. Also, when there is more than one matching class when making a fuzzy match, the instance of the first type-compatible class found is added.
argument¶
Name | Type | Description |
---|---|---|
fieldName | string | Field name Null or empty string cannot be specified. |
className | string | Class Name Specify the class name or fully qualified name. Null or empty string cannot be specified. |
direction | string | Additional direction -"first": First -"last": Last -"before": Before -"after": After |
target | IModel | Additional reference model The additional position is determined based on the model position specified here. When the direction is specified as "first", it is added to the beginning regardless of the reference model. When the direction specification is "last", it is added to the end regardless of the reference model. When the direction is "before", the instance will be added to the specified model position, and when "after", the instance will be added to the next position of the specified model. |
fuzzy | bool | className argument as the name of the class instead of the fully qualified name. If False, evaluates as the class whose fully qualified name matches className. If True, evaluate as if the class whose class name matches className is specified. The default value is True. |
Return value¶
Exception¶
Name | Exception Class | Description |
---|---|---|
Invalid argument | ExtensionArgumentException | When null or an empty string is specified for fieldName or className When a string other than the default string is specified for direction The model specified as the reference for the additional position is If not included in the field value |
Field not found | ExtensionFieldNotFoundException | If the specified field is not found in this instance's metaclass |
Illegal field access | ExtensionIllegalFieldAccessException | When this method is executed for a field whose upper limit of multiplicity is 1 |
Specified field is invalid | ExtensionInvalidTypeException | If a value that cannot be set is specified for the specified field -The specified field is not a owned field -The data type of the specified field is not a class type -The specified field type is incompatible with the specified class |
Class not found | ExtensionTypeNotFoundException | If the specified class is not found |
Illegal operation | ExtensionInvalidOperationException | If the model itself is a deleted model or temporary proxy If an inoperable field is specified in the field name -Product line feature assignment field -System.Core tag Assigned field |